﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using KPIS.GERP.GBMS.BLL;
using KPIS.GERP.GBMS.MODEL;
using KPIS.GERP.GBMS.IBLL;
using Telerik.Web.UI;

namespace KPIS.GERP.GBMS.APP_UI
{
    public partial class OptionDataGrid : System.Web.UI.UserControl
    {
        private IProjectOptionBLL pj;
        private Object pjObj;

        public Object ProjectOption
        {
            get { return pjObj; }
            set { pjObj = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        }
        #endregion

        protected void GridOption_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem item = e.Item as GridEditableItem;
                foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                {
                    if (!(column is GridEditableColumn)) continue;
                    if (item[column.UniqueName].Controls[0] is TextBox  || item[column.UniqueName].Controls[0] is RadComboBox)
                    {
                        (item[column.UniqueName].Controls[0] as WebControl).Width = Unit.Percentage(80);
                    }
                    if (column.UniqueName == "TemplateColumn")
                    {
                        (item[column.UniqueName].Controls[1] as WebControl).Width = Unit.Pixel(50);
                    }
                }
            }
        }

        protected void GridOption_ItemCommand(object source, GridCommandEventArgs e)
        {
        }
    }
}